﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WorkReportList.aspx.cs"
    Inherits="ZLDC.Estate.UM.WorkReportList" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>工作总结</title>
    <link href="../css/main.css" rel="stylesheet" type="text/css" />
    <link href="../js/jquery/style/jquery.hiAlerts.css" rel="stylesheet" type="text/css" />
    <script src="../js/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
    <link href="../js/jquery/style/jquery.simple.tree.css" rel="stylesheet" type="text/css" />   
    <link href="../js/jquery.autocomplete/jquery.autocomplete.css" rel="stylesheet" type="text/css" />
    <script src="../js/jquery/jquery.hiAlerts-min.js" type="text/javascript"></script>
    <script src="../js/My97DatePicker/WdatePicker.js" type="text/javascript"></script>

  

 

</head>
<body >
    <form id="form1" runat="server">
       <div id="divOperate" style="margin-top: 2px; margin-bottom: 2px; ">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td height="24" bgcolor="#353c44">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <td>
                                <img src="../images/tb.gif" width="14" height="14" /><span id="Span1" class="STYLE1">工作总结</span>
                            </td>
                            <td>
                                <div align="right" id="div1">
                                    <img src="../images/add.gif" width="10" height="10" />
                                    <strong><a style='cursor: pointer; color:#FFFFFF;' href="javascript:showDialog();">新增工作总结</a></strong>
                                </div>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </div>      
        <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#a8c7ce">
           
            
            <tr>
                <td style="text-align: left; background-color: #FFFFFF; cursor: pointer;" valign="middle"
                    colspan="2">
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    时间<input id="StartTime" onclick="WdatePicker()" style="width:80px;" type="text" />
                    ~
                    <input id="EndTime" onclick="WdatePicker()" style="width:80px;" type="text" />
                </td>
               <td style="text-align: left; background-color: #FFFFFF; cursor: pointer;"
                    valign="middle">
                    &nbsp;部门<a href="#" id="selDept" onclick="javascript:showDept('dvDept')">↓</a>
                     <div id="dvDept" style="overflow: auto; z-index: 2000; position: absolute; display: none;
                        border: 1px; border-style: outset; background-color: #ffffff; height: 145px;
                        width: 200px; text-align: left;">
                        <asp:Literal ID="ltlDeptTree" runat="server"></asp:Literal>
                    </div>
                    <input id="umainclass" title='拼音首字母提示' style="width: 70px" name="umainclass" onblur="selDU()" />                
                    <input id="utxtmain"   runat="server" style="display: none;" />                                       
                </td>
               <td style="text-align: left; background-color: #FFFFFF; cursor: pointer;"
                    valign="middle">
                    人员:<input id="usubclass" title='拼音首字母提示,格式:姓名[工号,部门]' style="width: 70px" name="umainclass"
                    onblur="selDU()" />
                    <input id="utxtsub" name="utxtsub" runat="server" style="display: none;" />                    
                    <input id="btnSearch" class="button_bak" type="button" value="查询" onclick="return ShowList('1')" />
                </td>
            </tr>
        </table>
        <div id="divList">
        </div>
        <div id="divPage">
        </div>
        <input id="utxdeptid" name="utxdeptid" runat="server" type="hidden" />
        <asp:HiddenField ID="hdReplyLimits" runat="server" Value="0" />
        <asp:HiddenField ID="hdCurentUser" runat="server" Value="0" />

    
    </form>

    <script src="../js/LexunJS.js" type="text/javascript"></script>

    <script src="../js/jShowDiv.js" type="text/javascript"></script>

    <script src="../js/jquery.autocomplete/jquery.autocomplete.min.js" type="text/javascript"></script>

    <script src="../js/jquery/jquery.simple.tree.js" type="text/javascript"></script>

    <script src="../js/DeptTree.js" type="text/javascript"></script>

    <script type="text/javascript">
        var currentPage = 1; // 当前页
        var pageSize = 10; // 每页显示多少条
        var pageall = 0; // 总页数
        var total = 0; // 总记录数
        var type = 0;
        $(document).ready(function() {
            ShowList(currentPage);
        });
        // 弹出窗口,
        function showDialog(id) {
            var path = "WorkReport.aspx?id="+id+"";
            var parameter = "";
            var style = "dialogWidth:523px; dialogHeight:377px; status:0;scroll:1; help:0; resizable:1;Scrollbars=yes,Toolbar=no,Location=no,Direction=no,Resizeable=no";
            window.showModalDialog(path, window, style);
            ShowList(currentPage);
        }

        function showModelDialog(id) {
            var path = "WordReplaceList.aspx?id="+id+"";
            var parameter = "";
            var style = "dialogWidth:638px; dialogHeight:400px; status:0;scroll:1; help:0; resizable:1;Scrollbars=yes,Toolbar=no,Location=no,Direction=no,Resizeable=no";
            window.showModalDialog(path, window, style);
            ShowList(currentPage);
        }
        
        function ShowList(currentPage) {
            $("#divList").html(""); // 清空列表
            $("#divPage").html(""); // 清空分页
            $("#divList").html("<img src=\"../images/loading.gif\" />"); // 清空列表
            var stratTime = document.getElementById("StartTime").value;
            var endTime = document.getElementById("EndTime").value;
            var deptid = document.getElementById("utxdeptid").value;
            var username = document.getElementById("utxtsub").value;
            $.ajax({
                type: 'POST',
                url: '../Handler/HandlerReport.ashx',
                data: 'act=p_dayReport_list_table&page=' + currentPage + '&pagesize=' + pageSize+'&sTime='+stratTime+'&eTime='+endTime+'&deptid='+deptid+'&userName='+username,
                timeout: '10000',
                error: function() {
                    alert("系统繁忙，请稍候后试！");
                },
                success: function(json) {
                    ShowCallBack(json);
                }
            });
        }

        function ShowCallBack(response) {
            var json = eval("(" + response + ")");
            var record = json.record;
            var page = json.page;
            currentPage = page.currentpage;
            pageall = parseInt(page.pageall);
            total = page.total;
            var hdReplyLimits = $("#hdReplyLimits").val();    // 0不允许修改 1允许修改
             var hdCurentUser = $("#hdCurentUser").val();    // 0不允许修改 1允许修改
           if (record == null || record.length == 0) {
                $("#divList").html("<font color='red'>&nbsp;系统内暂无您查询的信息!</font>");
                return;
            }
            $("#divList").html(""); // 显示列表
            var arr = [];
            arr.push("<table id='table2' width='100%' border='0' cellpadding='0' cellspacing='1' bgcolor='#a8c7ce'>");
            arr.push("<tr>");

            arr.push("<td height='25'  bgcolor='d3eaef' class='STYLE10'>");
            arr.push("操作");
            arr.push("</td>");
            arr.push("<td height='25' bgcolor='d3eaef' class='STYLE10'>");
            arr.push("汇报时间</td>");
            arr.push("<td height='25' bgcolor='d3eaef' class='STYLE10'>");
            arr.push("标题</td>");
            arr.push("<td height='25' bgcolor='d3eaef' class='STYLE10'>");
            arr.push("人员</td>");
            arr.push("<td height='25' bgcolor='d3eaef' class='STYLE10'>");
            arr.push("提交时间</td>");
            arr.push("<td height='25' bgcolor='d3eaef' class='STYLE10'>");
            arr.push("部门</td>");

            arr.push("</tr>");

            for (var i = 0; i < record.length; i++) {
                if (i % 2 == 0)
                    arr.push("<tr id='tr_" + record[i].id + "' bgcolor='#FFFFFF' style='cursor: pointer;' ondblclick=\"showModelDialog('"+record[i].id+"')\" onclick=\"selectedTr('" + record[i].id + "')\" >");
                else
                    arr.push("<tr id='tr_" + record[i].id + "' bgcolor='#EEEDED' style='cursor: pointer;' ondblclick=\"showModelDialog('" + record[i].id + "')\"  onclick=\"selectedTr('" + record[i].id + "')\" >");

                arr.push("<td height='25'  class='STYLE10' >");
                if (record[i].readflag == "1") {
                    arr.push("<a href='javascript:showModelDialog(" + record[i].id + ")'><img src='../images/thread.gif' title='经理已回复'></a>");
                }
                else {
                    if (hdCurentUser != record[i].adduserid && hdReplyLimits == "1") {
                        arr.push("<a href='javascript:showModelDialog(" + record[i].id + ")'>经理回复</a>");
                    }
                }
                
                if (hdCurentUser == record[i].adduserid) {
                        arr.push("<a href='javascript:showDialog(" + record[i].id + ")'>修改</a>");
                }
                arr.push("</td>");
                arr.push("<td height='25' class='STYLE10'>");
                arr.push("" + record[i].reportdate + "</td>");
                arr.push("<td height='25' class='STYLE10'>");
                arr.push("" + record[i].title + "</td>");
                arr.push("<td height='25'  class='STYLE10'>");
                arr.push("" + record[i].adduser + "</td>");
                arr.push("<td height='25'  class='STYLE10'>");
                arr.push("" + record[i].adddate + "</td>");
                arr.push("<td height='25'  class='STYLE10'>");
                arr.push("" + record[i].adddept + "</td>");
                arr.push("</tr>");
            }


            arr.push("</table>");
            $("#divList").html(arr.join('')); // 显示列表
            $("#divPage").html(""); // 清空
            if (pageall > 1) {

                var pageHtml = LexunJS.showPage(currentPage, pageall, "ShowList");  // 分页
                $("#divPage").html(pageHtml);

            }

        }
        // 选中某行
        function selectedTr(id) {
            $("tr").removeClass("selected");
            $("#tr_" + id).addClass("selected");
            
        }
    </script>

</body>
</html>
